<template>
  <div>
    <div class="blueHead">通讯录</div>
    <van-search v-model="value" placeholder="请输入搜索关键词" />
    <van-tabs v-model="activeName" color="#4e90ff">
      <van-tab title="联系人" name="联系人">
        <van-collapse v-model="activeNames">
          <van-collapse-item title="部门联系人" name="1">
            <router-link
              tag="div"
              class="contactsList"
              v-for="item in contactsData"
              :key="item.id"
              :to="{ name: 'Chat', params: { data: item.name } }"
            >
              <span class="addresTitle">{{ item.title }}</span>
              <span class="addresName">{{ item.name }}</span>
            </router-link>
          </van-collapse-item>
          <van-collapse-item title="工作联系人" name="2"
            >内容</van-collapse-item
          >
        </van-collapse>
      </van-tab>
      <van-tab title="组群" name="组群">
        <van-collapse v-model="activeNames">
          <van-collapse-item title="工作群" name="1">
            <router-link
              tag="div"
              :to="{ name: 'Chat', params: { data: title } }"
              class="contactsList"
            >
              <div class="addresImg">
                <img
                  src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607344905447&di=ced967a6564a31aea4ec44c08cdb77c4&imgtype=0&src=http%3A%2F%2Fi1.sinaimg.cn%2FIT%2F2010%2F0419%2F201041993511.jpg"
                  alt=""
                />
              </div>
              <div class="addresGroupName">{{ title }}</div>
            </router-link>
          </van-collapse-item>
          <van-collapse-item title="工作组" name="2">内容</van-collapse-item>
        </van-collapse>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import api from "../api";
export default {
  name: "addresBar",
  data() {
    return {
      activeName: "联系人",
      value: "",
      activeNames: ["1"],
      contactsData: [],
      title: "爱康智慧管家",
    };
  },

  methods: {},
  mounted() {
    api.contacts().then((res) => {
      this.contactsData = res.data.data;
    });
  },
};
</script>

<style scoped >
.blueHead {
  width: 100%;
  height: 1rem;
  background: #4e90ff;
  font-size: 20px;
  text-align: center;
  color: rgb(255, 255, 255);
  line-height: 1rem;
  letter-spacing: 5px;
}
.contactsList {
  margin: 0.25rem;
  width: 100%;
  height: 0.8rem;
  position: relative;
}
.addresImg {
  border-radius: 50%;
  overflow: hidden;
  width: 0.8rem;
  height: 0.8rem;
  float: left;
}
.addresGroupName {
  display: inline-block;
  height: 0.8rem;
  line-height: 0.8rem;

  margin: 0 0.2rem 0 0.2rem;
  float: left;
}
.addresTitle {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  background: #4e90ff;
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 0.8rem;
}

.addresName {
  /* display: inline-block; */
  height: 0.8rem;
  line-height: 0.8rem;
  margin: 0.2rem;
}
img {
  width: 0.8rem;
  height: 0.8rem;
}
</style>